﻿<script type="text/javascript">
    function Login() {
        if ($('#usercode').val() == "") {
            messageAlert("请输入用户名");
            return;
        }
        var loginForm = $('#LoginForm');
        loginForm.submit();
    }

    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            Login();
        }
    });
</script>
@model CNKI.TPI.Web.UI.Models.LoginModel
<div class="wrap power-login">
    <h2 class="power-login-t"><span>用户登录</span></h2>
    @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { id = "LoginForm", @class = "form form-h power-login-b" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)
        if (Request.IsAuthenticated)
        {
        <div class="welcome">@User.Identity.Name 您好！您没有访问该页面的权限</div>
        <div class="login-btn">
            @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
            {
                @Html.AntiForgeryToken()
                <a class="btn btn-m btn-submit btn-warn-f" href="javascript:document.getElementById('logoutForm').submit()">注销</a>
            }
        </div>
        }
        else
        {
        <div class="f-gp">
            <div class="f-lb">
                <label class="f-label">用户名：</label>
            </div>
            <div class="f-ct">
                @Html.TextBoxFor(m => m.UserName, new { @class = "f-text span3",maxlength="50", id="usercode"})
            </div>
        </div>
        <div class="f-gp">
            <div class="f-lb">
                <label class="f-label">密码：</label>
            </div>
            <div class="f-ct">
                @Html.PasswordFor(m => m.Password, new { @class = "f-text span3",maxlength="50" })
            </div>
        </div>@*
        <div class="f-gp">
            <div class="f-lb">
                <label class="f-label">验证码：</label>
            </div>
            <div class="f-ct">
                <input type="text" class="f-text" placeholder="">
                <img class='yzm' src="images/yzm.gif" alt="" />
                <span class='yzm-a'>看不清</span>
                <a href="" class='yzm-a changecode'>换一张</a>
            </div>
        </div>*@

        <div class="f-gp">
            <div class="f-lb">
            </div>
            <div class="f-ct">
                <a href="javascript:Login();" class="btn btn-l btn-submit btn-warn-f">登录</a>
            </div>
        </div>
        }
    }
</div>
